@extends('layouts.default') 
@section('main')
    <link rel="stylesheet" href="{{URL::asset('js/')}}/kindeditor-4.1.7/themes/default/default.css" />
    <link rel="stylesheet" href="{{URL::asset('js/')}}/kindeditor-4.1.7/plugins/code/prettify.css" />
    <script src="{{URL::asset('js/')}}/kindeditor-4.1.7/kindeditor.js" type="text/javascript"></script> 
    <script charset="utf-8" src="{{URL::asset('js/')}}/kindeditor-4.1.7/lang/zh_CN.js"></script> 
    <script charset="utf-8" src="{{URL::asset('js/')}}/kindeditor-4.1.7/plugins/code/prettify.js"></script>
    <script type="text/javascript" src="{{URL::asset('js/')}}/ajaxfileupload.js"></script>
    <script type="text/javascript" src="{{URL::asset('js/')}}/common.js"></script>
    <script src="{{URL::asset('js/My97DatePicker/')}}/WdatePicker.js"></script> 
    <script>
    KindEditor.ready(function(K) {

            var editor1 = K.create('#project_content,#project_invest_aim,#project_fund_plan,#project_team_advantage', {
                uploadJson: "{{url('kindedit/upload')}}",
                fileManagerJson: "{{url('kindedit/manager')}}",
                allowFileManager: true
            });
            
    });
    </script>
    <div id="content">
        <div id="content-header">
            <div id="breadcrumb">
                <a href="{{url('home')}}" title="返回首页" class="tip-bottom"><i
                            class="icon-home"></i> 首页</a> <a href="{{url('project/index')}}" class="tip-bottom">项目管理</a> <a href="#" class="current">项目信息修改</a>
            </div>
        </div>
        <div class="container-fluid">
            <div class="row-fluid">
                <div class="span7" style="width:80%;">
                    <div class="widget-box">
                        <div class="widget-title">
						<span class="icon"> <i class="icon-align-justify"></i>
						</span>
                            <h5>基础信息</h5>
                        </div>
                        <div class="widget-content nopadding">
                            <form class="form-horizontal" >
                                <div class="control-group">
                                    <label class="control-label">项目ID :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="id" value="{{$project->id}}" readonly="readonly" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">项目名称 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="subject" value="{{$project->subject}}" readonly="readonly"  />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">副标题 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="title" value="{{$project->title}}" readonly="readonly" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">项目阶段 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="project_period" @if(isset($project_period[$project->project_period])) value="{{$project_period[$project->project_period]}}" @endif readonly="readonly"  />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">融资阶段 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="invest_period" @if(isset($invest_period[$project->invest_period])) value="{{$invest_period[$project->invest_period]}}" @endif readonly="readonly"  />
                                    </div>
                                </div>
                                
                                <div class="control-group">
                                    <label class="control-label">融资方式 :</label>
                                    <div class="controls">
                                        <label> <input type="radio" name="invest_way" value="1" <?php if($project->invest_way == 1) echo 'checked="checked"'; ?> /> 股权融资
                                        </label> <label> <input type="radio" name="invest_way" value="2" <?php if($project->invest_way == 2) echo 'checked="checked"'; ?> /> 债券融资
                                        </label><label> <input type="radio" name="invest_way" value="3" <?php if($project->invest_way == 3) echo 'checked="checked"'; ?> /> 融资租赁
                                        </label>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">融资目的 :</label>
                                    <div class="controls">
                                        <textarea id="project_invest_aim" name="invest_aim" style="width: 450px; height: 240px;" readonly="readonly"><?php echo htmlspecialchars_decode($project->invest_aim); ?></textarea>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">行业分类 :</label>
                                    <div class="controls">
                                        @foreach($categories as $key => $category)
                                            <input type="checkbox" name="categories[]" value="{{ $key }}"<?php foreach ($project_categories as $project_category) {
                                                if($project_category == $key) echo 'checked="checked"';}
                                            ?> readonly="readonly" >&nbsp{{$category}}
                                            
                                        @endforeach
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">项目简介 :</label>
                                    <div class="controls">
                                        <textarea id="description" name="description" cols="150" rows="6" style="width:650px;" readonly="readonly">{{$project->description}}</textarea>
                                    </div>
                                </div>
                                
                                <div class="control-group">
                                    <label class="control-label">内容 :</label>
                                    <div class="controls">
                                        <textarea id="project_content" name="content" style="width: 450px; height: 240px;" ><?php echo htmlspecialchars_decode($project->content); ?></textarea>
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">列表页缩略图 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="photo"
                                            placeholder="图片" />
                                        <a href="javascript:void(0);" id="uploadPhotoBtn" class="icon-picture"  onclick="javascript:openBrowse('uploadPhotoBtn','uploadPhoto');"></a>
                                            <input type="file" id="uploadPhoto" style="display:none"  size="10" onchange="fileUpload('uploadPhoto','photo')"/>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">所在地区 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="zone_id" value="{{$project->zone->name or ''}}" readonly="readonly"  />
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">发布时间 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="pubdate" value="<?php echo date('Y-m-d H:i:s',$project->pubdate); ?>" placeholder="发布时间" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"  readonly="readonly" />
                                    </div>
                                </div>
                                
                                <div class="control-group">
                                    <label class="control-label">项目拥有人 :</label>
                                    <div class="controls">
                                        <select name="uid" id="uid">
                                            @foreach( $users as $key => $user )
                                                <option value="$key" <?php if( $key== $project->uid) echo 'selected'; ?>>{{ $user }}</option>
                                            @endforeach
                                        </select>
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">项目开始时间 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="start_time" value="<?php echo date('Y-m-d H:i:s',$project->start_time); ?>" placeholder="项目开始时间" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" readonly="readonly" />
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">排序 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="sort" value="{{$project->sort}}" readonly="readonly" />
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">联系人 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="contact" value="{{$project->contact}}" readonly="readonly" />
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">电话 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="phone" value="{{$project->phone}}" readonly="readonly" />
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">联系人地址 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="address" value="{{$project->address}}" readonly="readonly" />
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">联系人Email :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="email" value="{{$project->email}}" readonly="readonly" />
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">邮编 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="postcode" value="{{$project->postcode}}" readonly="readonly" />
                                    </div>
                                </div>
                              
                                <div class="control-group">
                                    <label class="control-label">融资金额 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="invest_fund" value="{{$project->invest_fund}}" readonly="readonly" />
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">投资前估值 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="invest_value" value="{{$project->invest_value}}" readonly="readonly" />
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">出让股份 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="transfer_share" value="{{$project->transfer_share}}" readonly="readonly" />
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">资金用途 :</label>
                                    <div class="controls">
                                        <textarea id="project_fund_plan" name="fund_plan" style="width: 450px; height: 240px;" readonly="readonly"><?php echo htmlspecialchars_decode($project->fund_plan); ?></textarea>                  
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">团队优势 :</label>
                                    <div class="controls">
                                        <textarea id="project_team_advantage" name="team_advantage" style="width: 450px; height: 240px;"><?php echo htmlspecialchars_decode($project->team_advantage); ?></textarea>                  
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">团队规模 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="team_size" value="{{$project->team_size}}"  />
                                    </div>
                                </div>
                              
                                <div class="control-group">
                                    <label class="control-label">项目评分 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="score" value="{{$project->score}}" readonly="readonly"  />
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">项目月收入 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="month_income" value="{{$project->month_income}}" readonly="readonly"  />
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">聊天群ID :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="groupid" value="{{$project->groupid}}" readonly="readonly"  />
                                    </div>
                                </div>

                                <div class="widget-title">
                                    <span class="icon"> <i class="icon-align-justify"></i></span>
                                    <h5>状态选项</h5>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">是否推荐 :</label>
                                    <div class="controls">
                                        <label> <input type="radio" name="recommend" value="1"    <?php if($project->recommend == 1) echo 'checked="checked"'; ?> /> 是
                                        </label> <label> <input type="radio" name="recommend" value="0"  <?php if($project->recommend == 0) echo 'checked="checked"'; ?> /> 否
                                        </label>
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">是否热门 :</label>
                                    <div class="controls">
                                        <label> <input type="radio" name="hot" value="1" <?php if($project->hot == 1) echo 'checked="checked"'; ?> /> 是
                                        </label> <label> <input type="radio" name="hot" value="0" <?php if($project->hot == 0) echo 'checked="checked"'; ?> /> 否
                                        </label>
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">是否置顶 :</label>
                                    <div class="controls">
                                        <label> <input type="radio" name="stick" value="1" <?php if($project->stick == 1) echo 'checked="checked"'; ?> /> 是
                                        </label> <label> <input type="radio" name="stick" value="0" <?php if($project->stick == 0) echo 'checked="checked"'; ?> /> 否
                                        </label>
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">是否头条 :</label>
                                    <div class="controls">
                                        <label> <input type="radio" name="top" value="1" <?php if($project->top == 1) echo 'checked="checked"'; ?> /> 是
                                        </label> <label> <input type="radio" name="top" value="0" <?php if($project->top == 0) echo 'checked="checked"'; ?> /> 否
                                        </label>
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">是否路演 :</label>
                                    <div class="controls">
                                        <label> <input type="radio" name="is_roadshow" value="1" <?php if($project->is_roadshow == 1) echo 'checked="checked"'; ?> /> 是
                                        </label> <label> <input type="radio" name="is_roadshow" value="0" <?php if($project->is_roadshow == 0) echo 'checked="checked"'; ?> /> 否
                                        </label>
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">是否审核通过 :</label>
                                    <div class="controls">
                                        <label> <input type="radio" name="status" value="1" <?php if($project->status == 1) echo 'checked="checked"'; ?> /> 是
                                        </label> <label> <input type="radio" name="status" value="0" <?php if($project->status == 0) echo 'checked="checked"'; ?> /> 否
                                        </label>
                                    </div>
                                </div>
    
                                {{--@endif--}}
    
                            </form>
                            <a href="{{url('project/edit?id='.$project->id)}}" target="_blank"><button class="btn btn-success">编辑</button></a>
                        </div>
                        @include('message.flash')
                        @include('errors.list')
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
       window.um = UM.getEditor('project_content');
       window.um = UM.getEditor('project_invest_aim');
       window.um = UM.getEditor('project_fund_plan');
       window.um = UM.getEditor('project_team_advantage');    

    </script>
    <script>
    
        $("#city").change(function() {
            $("#zone").empty();
            $.post("{{url('zone/children')}}", {
                id: $(this).val()
            }, function(data) {
                if (data.status) {
                    var html = '<option value="0">城市</option>';
                    $.each(data.message, function(i, n) {
                        html += "<option value='"+n.id+"'>"+n.name+"</option>";
                    });
                    $("#zone").html(html);
                }
            }, 'json');
        });   

    </script>
@stop
